#pragma once

typedef void (CALLBACK * pfnThreadCALLBACK)( LPVOID pParam);

class CMyThread
{
public:
	CMyThread(void);
	CMyThread(pfnThreadCALLBACK pCallback);
	virtual ~CMyThread(void);

	void StopThread();
	void StartThread(int nInterval = 1000);
	void RunThread();

protected:
	HANDLE m_hThread;
	HANDLE m_hThreadEndEvent;

	CRITICAL_SECTION m_csMyBlock;
	int    m_nInverval;
	pfnThreadCALLBACK m_pCallback;
	//unsigned m_uiThreadId;

private:
	static UINT WINAPI ThreadProc(LPVOID pParam);
	virtual void Run();

};
